using System.Globalization;
using Fiddler;
using FiddlerAmfParser.Rendering;
using FluorineFx.IO;

namespace FiddlerAmfParser.OutputProcessing
{
	internal class FiddlerScriptOutputProcessor : IOutputProcessorPlugin
	{
		public byte RenderOrder { get { return 129; } }

		public void ProcessAmfMessage(ParserContext ctx, AMFMessage messageData)
		{ }

		public void ProcessAmfBody(ParserContext ctx, AMFBody bodyData)
		{
			var jsonBodyData = Newtonsoft.Json.JsonConvert.SerializeObject(bodyData.Content);
			FiddlerApplication.scriptRules.DoMethod("AmfParserCallback", new object[] {jsonBodyData, bodyData.Content});
		}
	}
}